<div class="form">

    <p>&nbsp;</p>


<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'objectqvfilters-form',
	'enableAjaxValidation'=>true,
)); ?>

    <div id="floatingbar">

<?php echo CHtml::ajaxButton($model->isNewRecord ? 'Create' : 'Update',
        CHtml::normalizeUrl(array('//objectqvfilters/subviewedit')),
        array(
            'type'=>'POST',
            'success'=>'function(responseText,statusText) {
                            $.fn.yiiGridView.update(\'qvfilters-grid\');
                        }',
        ),
        array('class'=>'ui-button ui-widget ui-corner-all','id'=>'fil_save_button'));
?>

        </div>

    <fieldset class="box">
        <legend>filter detail options</legend>

	<?php echo $form->errorSummary($filmodel); ?>
        <?php echo $form->hiddenField($filmodel,'objfil_id'); ?>
        <?php echo $form->hiddenField($filmodel,'objectlink_id'); ?>
	<?php echo $form->error($filmodel,'objectlink_id'); ?>
        <table>
            <tr>
                <td>
                    <?php echo $form->labelEx($filmodel,'qvf_id'); ?><br/>
                    <?php
                    echo $form->DropDownList($filmodel,
                            'qvf_id',
                            CHtml::listData(Qvfields::model()->findAll("qvf_docName = :qvf_docName",array(':qvf_docName'=>strtoupper(Qvobjects::model()->findByPK(Objects::model()->findByPK($_GET['id'])->qvo_id)->qvo_docName))),'qvf_id','qvf_fieldName'),
                            array(
                            'ajax'=>array(
                                'type'=>'POST',
                                'url'=>Yii::app()->createUrl('//qvmapping/loadObjectValues'),
                                'update'=>'#qvv_values',
                                'data'=>array('id'=>'js:this.value'),
                            ),
                            'style'=>'width:300px;'   
                        )
                    );
                    ?>

                </td>
                <td rowspan="2" style="valign:top">
                    <?php echo $form->labelEx($filmodel,'filter'); ?><br/>
                    <?php echo $form->TextArea($filmodel,'filter',array('cols'=>'45','rows'=>'16')); ?>
                    <?php echo $form->error($filmodel,'filter'); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:270px;height:240px;overflow: auto;background: #ffffff;z-index:0;border: 1px solid">
<?php

    $itemsone = CHtml::listData(Qvvalues::model()->findAll('qvf_id = :qvf_id',array(':qvf_id'=>$filmodel->qvf_id)),'qvv_id','qvv_fieldValue');

    $this->Widget('zii.widgets.jui.CJuiSelectable', array(
            'items'=>$itemsone,
            'id'=>'qvv_values',
            // additional javascript options for the draggable plugin
            'options'=>array(
                'selected'=>"js:function(event,ui){
                    var tempVal = $('#ObjectQvfilters_filter').val();
                    $('#ObjectQvfilters_filter').val(tempVal + ',' + $(ui.selected).text() + '');
                }",
            ),
    ));

?>
                    </div>
                </td>
            </tr>
        </table>

    </fieldset>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

<?php $this->endWidget(); ?>

</div><!-- form -->

<?php
$this->widget('ext.ajaxform.JAjaxForm',array(
    'formId'=>'objectqvfilters-form',
    'options'=>array(
        'dataType'=>'json',
    ),
));
?>


<?php $this->widget( 'ext.EChosen.EChosen',
        array(
          'target'=>'select',
          'useJQuery' => true,
          'debug' => true,
)); ?>